package data.controller.send
{
	import flash.utils.ByteArray;
	
	import base.net.socket.packet.SocketSendablePacket;
	
	import data.controller.packCode.UserPackCode;
	import data.packetBuffer.users.BufferUserLogin;

	public class UserDataSend extends DataSendBase
	{
		public function UserDataSend()
		{
		}
		
		/**
		 * 用户登陆
		 * @param serverID 服区ID
		 * @param userName 用户名称
		 */
		public function login(serverID:int, userName:String):void
		{
			var bufferUserLogin:BufferUserLogin=new BufferUserLogin();
			bufferUserLogin.serverID=1;
			bufferUserLogin.userAccount="devin2";
			var ba:ByteArray=new ByteArray();
			bufferUserLogin.writeToDataOutput(ba);
			var baStr:String="";
			for(var i:int=0;i<ba.length;i++)
			{
				baStr+=", "+ba[i];
			}
//			trace("body:"+baStr);
			var socketSendablePacket:SocketSendablePacket=new SocketSendablePacket(UserPackCode.USER_LOGIN);
			socketSendablePacket.writeBytes(ba);
			send(socketSendablePacket);
		}
	}
}